<?php

include '../../db.php';
$connect = pg_connect($connectionString);
if (!$connect) {
    echo "connect : A connection to the server could not be established!";
    return false;
}


$queryString = "SELECT id,fullname as label, fullname as label, quantity, price FROM warehouse_product WHERE fullname LIKE '%" . strtoupper($_GET['term']) . "%'";

$query = pg_query($connect, $queryString);
if (!$query) {
    echo 'query : ';
    return false;
}
$arrRegistros = pg_fetch_all($query);
echo json_encode($arrRegistros);
pg_close($connect);
